<template>
  <div class="box">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="1"
      :page-sizes="[5, 10, 20]"
      :page-size="10"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 10
    }
  },
  data() {
    return {
      handleSize: 10,
      handleCurrent: 1
    };
  },
  methods: {
    handleSizeChange(val) {
      this.handleSize = val;
      this.newPageInfo();
    },
    handleCurrentChange(val) {
      this.handleCurrent = val;
      this.newPageInfo();
    },
    newPageInfo() {
      this.$emit("pageIndex", {
        pageSize: this.handleSize || 10,
        pageIndex: this.handleCurrent || 1
      });
    }
  },
  data() {
    return {
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4
    };
  }
};
</script>

<style lang="scss" scoped>
.box {
  // height: fit-content;
  flex-shrink: 0;
  flex: 0;
  justify-content: flex-end;
}
</style>
